package org.tarena.dang.action.main;

import java.sql.SQLException;
import java.util.List;

import org.tarena.dang.action.BaseAction;
import org.tarena.dang.entity.Book;
import org.tarena.dang.service.BookService;
import org.tarena.dang.service.BookServiceImp;

public class SortAction extends BaseAction {
	private List<Book> books;
	private String sort;
	public String execute(){
		BookService bookService = new BookServiceImp();
		if("priced".equals(sort)){
			try {
				books = bookService.findByCid(10, 2, 4);
				System.out.println("ajax---"+books.size());
			} catch (SQLException e) {
				e.printStackTrace();
			}
		}
		return "success";
	}
	public List<Book> getBooks() {
		return books;
	}
	public void setBooks(List<Book> books) {
		this.books = books;
	}
	public String getSort() {
		return sort;
	}
	public void setSort(String sort) {
		this.sort = sort;
	}
	
}
